<template>
  <div class="item" @click="handleClick(item.id)">
    <img :src="item.coverUrl" alt="" />
    <p>{{ item.name }}</p>
  </div>
</template>

<script setup>
const $props = defineProps({
  item: {
    type: Object,
    required: true,
  },
});
/* 子组件给父组件传递参数 */
const $emit = defineEmits(["jump"]);
const handleClick = (id) => {
  $emit("jump", id);
};
</script>

<style scoped>
.item {
  padding: 5px;
  display: flex;
  border: 1px solid #333;
  margin: 5px;
}
.item img {
  width: 50px;
  height: 50px;
}
</style>
